import { _decorator, Component, Node, Input, EventTouch, NodeEventType, input } from 'cc';
const { ccclass, property } = _decorator;
import { Emney } from '../../interface/Emney';

//展示没用的类
class tank_player extends Component implements Emney  {

    HP: number = 100;
    attack() {
      
    }
    denfend() {
     
    }

    // 满足条件调用回调
    judgeDeath(callback: Function) {
        if(this.HP <= 0){
            callback();
        }
    }
    
    
    //onLoad和start同时执行，但是相对来说，onLoad更快，并且是所有子节点脚本执行完onLoad后才开始start（）
    onLoad() {
        console.log('tank_player onload')
    }

    onEnable() {

    }

    start() {

    }

    update(deltaTime: number) {
        // 每一帧被调用
        // 每次被攻击是调用
        this.judgeDeath(this.isDead)
    }
    isDead(){
        console.log('你死了');
        
    }

    updated() {

    }


    destroyed() {

    }


    //方便控制当前组件名字，可以不写
    @property
    text: string = 'hello'

}

